<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__STATIC__/template/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__STATIC__/template/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__STATIC__/template/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>合伙人介绍</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 合伙人介绍
    <span class="c-gray en">&gt;</span> <span style="color: red">内容</span>
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">

    <form class="form form-horizontal" id="add">

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">内容：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea id="editor" type="text/plain" style="width:100%;height:400px;">{$result?$result.content:''}</textarea>
            </div>
        </div>

        <div class="row cl">

            {empty name='result'}
            <label class="form-label col-xs-6 col-sm-6">
                <a class="btn btn-primary radius" href="javascript:;" onclick="content_add()">
                    <i class="Hui-iconfont">&#xe632;</i> 提交
                </a>
            </label>
            {else /}
            <input type="hidden" value="{$result.id}" id="rule_id"/>
            <label class="form-label col-xs-6 col-sm-6">
                <a class="btn btn-primary radius" href="javascript:;" onclick="content_edit()">
                    <i class="Hui-iconfont">&#xe632;</i> 修改</a>
            </label>
            {/empty}
        </div>
    </form>

</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__STATIC__/template/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__STATIC__/template/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/template/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="__STATIC__/template/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
    $(function(){
        var ue = UE.getEditor('editor');

    })
    /* 规则添加 */
    function content_add(){
        var content = UE.getEditor('editor').getContent() ;//富文本内容

        // alert(content);
        $.post('{:url(\'content_add\')}',{ content:content},function(res){
            console.log(res);
            if(res.ok){
                layer.msg(res.msg,{icon: 1,time:2000});
                setTimeout("window.location.replace(location.href)",1000);
            }else{
                layer.msg(res.msg,{icon: 5,time:2000});
            }
        });
    }

    function content_edit(){
        var content =  UE.getEditor('editor').getContent() ;//富文本内容
        var rule_id =   $('#rule_id').val();

        var url    = "{:url('content_edit')}";
        var data   = {
            content:content,
            rule_id:rule_id
        }
        $.post(url,data,function(res){
            console.log(res);
            if(res.ok){
                layer.msg(res.msg,{icon: 1,time:2000});
                setTimeout("window.location.replace(location.href)",1000);
            }else{
                layer.msg(res.msg,{icon: 5,time:2000});
            }
        })

    }
    /* 规则删除 */
    function content_del(obj,id){
        layer.confirm('删除后将不可恢复，确定删除吗？',function(index){
            $.post('{:url(\'content_del\')}',{ id:id },function(res){
                if(res.ok){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                }else{
                    layer.msg('删除失败!',{icon:1,time:1000});
                }
            });
        })
    }
</script>
</body>
</html>
